<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;

Route::group(function () {
//免登陆路由
    Route::post('login', 'Merchant/login');
    Route::post('smsCode', 'Merchant/smsCode');
    Route::post('roleByPhone', 'Store/roleByPhone');
    Route::post('upload', 'Publice/upload');
    Route::post('sign', 'Publice/sign');
    Route::post('config', 'Config/index');

})->middleware(\app\http\middleware\AllowOrigin::class);
//登陆路由
Route::group(function () {

    Route::get('merchantRole', 'Store/storeRole');
    Route::get('storeList', 'Store/storeList');


    Route::post('updateAccount', 'Merchant/updateAccount');

    Route::get('myStaff', 'Store/myStaff');
    Route::post('addStore', 'Store/addStore')->middleware(\app\http\middleware\MerchantLog::class,'添加门店');;
    Route::post('editStore', 'Store/editStore')->middleware(\app\http\middleware\MerchantLog::class,'添加门店');;
    Route::post('upStoreStatus', 'Store/upStoreStatus')->middleware(\app\http\middleware\MerchantLog::class,'添加门店');;
    Route::post('storeInfo', 'Store/storeInfo');
    Route::post('delStaff', 'Store/delStaff')->middleware(\app\http\middleware\MerchantLog::class,'删除员工');
    Route::post('upPassword', 'Store/upPassword')->middleware(\app\http\middleware\MerchantLog::class,'修改员工密码');
    Route::post('addStaff', 'Store/addStaff')->middleware(\app\http\middleware\MerchantLog::class,'添加员工');

    // 商品分类
    Route::post('classifyList', 'Classify/classifyList');
    Route::post('addClassify', 'Classify/addClassify')
        ->middleware(\app\http\middleware\MerchantLog::class,'添加分类');
    Route::post('editClassify', 'Classify/editClassify')
        ->middleware(\app\http\middleware\MerchantLog::class,'编辑分类');
    Route::post('upClassify', 'Classify/upClassify')
        ->middleware(\app\http\middleware\MerchantLog::class,'修改分类状态');


    Route::post('posterList', 'Poster/posterList');
    Route::post('addPoster', 'Poster/addPoster')
    ->middleware(\app\http\middleware\MerchantLog::class,'添加轮播图');
    Route::post('editPoster', 'Poster/editPoster')
        ->middleware(\app\http\middleware\MerchantLog::class,'编辑轮播图');
    Route::post('delPoster', 'Poster/delPoster')
        ->middleware(\app\http\middleware\MerchantLog::class,'删除轮播图');


    // 商品管理
    Route::post('addGoods', 'Goods/addGoods')
        ->middleware(\app\http\middleware\MerchantLog::class,'添加商品');
    Route::post('editGoods', 'Goods/editGoods')
        ->middleware(\app\http\middleware\MerchantLog::class,'修改商品');
    Route::post('upGoodsStatus', 'Goods/upGoodsStatus')
        ->middleware(\app\http\middleware\MerchantLog::class,'修改商品状态');
    Route::post('gooodsDiscount', 'Goods/gooodsDiscount');
    Route::post('goodsList', 'Goods/goodsList');
    Route::post('goodsInfo', 'Goods/goodsInfo');
    Route::post('consumptionDiscount', 'Goods/consumptionDiscount');

    Route::post('staffStatistics', 'Home/staffStatistics');
    Route::post('packageUseLogStatistics', 'Home/packageUseLog');


    // 套餐卡
    Route::post('packageList', 'Package/packageList');
    Route::post('packageBuyLog', 'Package/packageBuyLog');
    Route::post('addPackage', 'Package/addPackage')
        ->middleware(\app\http\middleware\MerchantLog::class,'添加套餐卡');
    Route::post('editPackage', 'Package/editPackage')
        ->middleware(\app\http\middleware\MerchantLog::class,'编辑套餐卡');
    Route::get('usePackage', 'Package/usePackage')
        ->middleware(\app\http\middleware\MerchantLog::class,'核销套餐卡');
    Route::post('upPackageStatus', 'Package/upPackageStatus')
        ->middleware(\app\http\middleware\MerchantLog::class,'修改套餐卡状态');
    Route::post('useLog', 'Package/useLog')
        ->middleware(\app\http\middleware\MerchantLog::class,'修改套餐卡状态');
    Route::post('userPackage', 'Package/userPackage');

    Route::post('UserPackageInfo', 'Package/UserPackageInfo');
    Route::post('discount', 'Package/discount');
    Route::post('packageUseLog', 'Package/packageUseLog');

    //优惠券
    Route::post('addCoupon', 'Coupon/addCoupon')
        ->middleware(\app\http\middleware\MerchantLog::class,'添加优惠券');
    Route::post('editCoupon', 'Coupon/editCoupon')
        ->middleware(\app\http\middleware\MerchantLog::class,'编辑优惠券');
    Route::post('upCouponStatus', 'Coupon/upCouponStatus')
        ->middleware(\app\http\middleware\MerchantLog::class,'修改优惠券状态');
    Route::post('couponList', 'Coupon/couponList');
    Route::post('userCouponList', 'Coupon/userCouponList');
    Route::post('receiveCoupon', 'Coupon/receiveCoupon')     ->middleware(\app\http\middleware\AdminLog::class,'领取优惠券');;
    Route::post('userAuthorityCoupon', 'Coupon/userAuthorityCoupon')     ->middleware(\app\http\middleware\AdminLog::class,'领取优惠券');;


    Route::post('payConfig', 'pay/payConfig');
    Route::post('upPay', 'pay/upPay')
    ->middleware(\app\http\middleware\MerchantLog::class,'修改支付配置');;

    Route::post('upConfig', 'Config/upConfig')
        ->middleware(\app\http\middleware\MerchantLog::class,'修改基础配置');;
    Route::post('TemplateList', 'Template/templateList');
    Route::post('upTemplate', 'Template/upTemplate')
        ->middleware(\app\http\middleware\MerchantLog::class,'首页模板编辑');

    Route::post('moduleList', 'Module/moduleList');
    Route::post('editModule', 'Module/editModule')
        ->middleware(\app\http\middleware\MerchantLog::class,'模块编辑');
    Route::post('upModuleStatus', 'Module/upModuleStatus')
        ->middleware(\app\http\middleware\MerchantLog::class,'修改模块状态');


    Route::post('addLevel', 'Level/addLevel')
        ->middleware(\app\http\middleware\MerchantLog::class,'添加会员等级');
    Route::post('levelList', 'Level/levelList');
    Route::post('editLevel', 'Level/editLevel')
        ->middleware(\app\http\middleware\MerchantLog::class,'编辑会员等级');
    Route::post('home', 'Home/index');
    Route::post('rechargeStatistics', 'Home/RechargeStatistics');
    Route::post('statistics', 'Home/statistics');

    Route::Post('addPayAmount', 'Pay/addPayAmount')
        ->middleware(\app\http\middleware\MerchantLog::class,'添加支付金额配置');;
    Route::Post('editPayAmount', 'Pay/editPayAmount')
        ->middleware(\app\http\middleware\MerchantLog::class,'修改支付金额配置');;
    Route::Post('delPayAmount', 'Pay/delPayAmount')
        ->middleware(\app\http\middleware\MerchantLog::class,'删除支付金额配置');;;
    Route::Post('payAmount', 'Pay/payAmount');
    Route::Post('setStatus', 'Pay/setStatus');


    // 订单
    Route::Post('goodsOrderList', 'Order/goodsOrderList');
    Route::Post('packageOrderList', 'Order/packageOrderList');
    Route::Post('goodsOrderInfo', 'Order/goodsOrderInfo');
    Route::Post('rechargeOrderList', 'Order/rechargeOrderList');
    Route::Post('amountLog', 'Order/amountLog');

    Route::Post('amountLogInfo', 'Order/amountLogInfo');
    Route::Post('rechargeOrder', 'Order/rechargeOrder');
    Route::Post('createGoodsOrder', 'Order/createGoodsOrder')
        ->middleware(\app\http\middleware\MerchantLog::class,'购买商品');
    Route::Post('withdrawalList', 'Order/withdrawalList');
    Route::Post('withdrawalReject', 'Order/withdrawalReject')
        ->middleware(\app\http\middleware\MerchantLog::class,'提现驳回');
    Route::Post('withdrawalPass', 'Order/withdrawalPass')
        ->middleware(\app\http\middleware\MerchantLog::class,'提现通过');

    Route::Post('completeGoodsOrder', 'Order/completeGoodsOrder')
        ->middleware(\app\http\middleware\MerchantLog::class,'核销商城订单');
    Route::Post('confirmReturns', 'Order/confirmReturns')
        ->middleware(\app\http\middleware\MerchantLog::class,'商品退款');


    Route::Post('createPackageOrder', 'Order/createPackageOrder')
        ->middleware(\app\http\middleware\MerchantLog::class,'购买套餐卡');
    Route::Post('upAddress', 'Order/upAddress')
        ->middleware(\app\http\middleware\MerchantLog::class,'修改用户收货地址');;
    Route::Post('upNum', 'Order/upNum')   ->middleware(\app\http\middleware\MerchantLog::class,'修改套餐使用次数');;
    Route::Post('express', 'Order/express')
        ->middleware(\app\http\middleware\MerchantLog::class,'添加订单快递信息');;

    Route::Post('paymentCodeGoods', 'Order/paymentCodeGoods')
        ->middleware(\app\http\middleware\MerchantLog::class,'商品在线支付');;


    Route::Post('userList', 'User/userList');

    Route::Post('balance', 'User/balance');
    Route::Post('userInfo', 'User/userInfo');
    Route::Post('delUser', 'User/delUser')
        ->middleware(\app\http\middleware\MerchantLog::class,'删除用户');
    Route::Post('userCommission', 'User/commission'); // 用户佣金
    Route::Post('userIntegral', 'User/userIntegral'); //  用户积分
    Route::Post('setAmount', 'User/setAmount')
        ->middleware(\app\http\middleware\MerchantLog::class,'修改用户余额');; //
    Route::Post('setTopUser', 'User/setTopUser')
        ->middleware(\app\http\middleware\MerchantLog::class,'修改用户上级');

    Route::Post('addPrinter', 'Store/addPrinter')
        ->middleware(\app\http\middleware\MerchantLog::class,'添加打印机');
    Route::Post('printerList', 'Store/printerList');

    Route::group(function () {

        Route::post('addBargaining', 'Bargaining/addBargaining');//   提现列表
        Route::post('editBargaining', 'Bargaining/editBargaining');//  申请提现
        Route::post('withdrawalInfo', 'Bargaining/withdrawalInfo');//  申请提现

    });

    Route::Post('Printing', 'Store/Printing');
    Route::Post('delPrinting', 'Store/delPrinting');
    Route::Post('editPrinter', 'Store/editPrinter')

        ->middleware(\app\http\middleware\MerchantLog::class,'修改打印机');;
})->middleware(\app\http\middleware\AllowOrigin::class)
    ->middleware(\app\http\middleware\MerchantCheckToken::class);



